<template>
  <el-config-provider :locale="zhCn">
    <dv-full-screen-container>
      <div class="page">
        <CompHeader />
        <div class="page__main">
          <CompSide />
          <div class="page__main__content">
            <router-view />
          </div>
        </div>
      </div>
    </dv-full-screen-container>
  </el-config-provider>
</template>

<script setup lang="ts">
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import '@/libs/EventBus'
import CompHeader from '@/layouts/CompHeader/index.vue'
import CompSide from '@/layouts/CompSide/index.vue'
import { onMounted } from 'vue'
import { getStatus, modbusRealSim } from '@/api'
import useMainStore from '@/store/main'

const store = useMainStore()

onMounted(() => {
  store.setIsReal(true)
  getStatus().then(({ data }) => {
    if (data.realSim !== 1) {
      modbusRealSim(true)
    }

    store.setIsMute(!!data.close)
  })
})
</script>

<style lang="scss" scoped>
.page {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.page__main {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  padding: var(--common-edge) var(--common-edge) var(--common-edge) 0;
  gap: var(--common-edge);
}

.page__main__content {
  width: 100%;
}
</style>
